home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / python2.4 / idlelib / Delegator.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2005-10-18  |  1KB  |  48 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.4)
  3.  
  4.  
  5. class Delegator:
  6.     
  7.     def __init__(self, delegate = None):
  8.         self.delegate = delegate
  9.         self._Delegator__cache = { }
  10.  
  11.     
  12.     def __getattr__(self, name):
  13.         attr = getattr(self.delegate, name)
  14.         setattr(self, name, attr)
  15.         self._Delegator__cache[name] = attr
  16.         return attr
  17.  
  18.     
  19.     def resetcache(self):
  20.         for key in self._Delegator__cache.keys():
  21.             
  22.             try:
  23.                 delattr(self, key)
  24.             continue
  25.             except AttributeError:
  26.                 continue
  27.             
  28.  
  29.         
  30.         self._Delegator__cache.clear()
  31.  
  32.     
  33.     def cachereport(self):
  34.         keys = self._Delegator__cache.keys()
  35.         keys.sort()
  36.         print keys
  37.  
  38.     
  39.     def setdelegate(self, delegate):
  40.         self.resetcache()
  41.         self.delegate = delegate
  42.  
  43.     
  44.     def getdelegate(self):
  45.         return self.delegate
  46.  
  47.  
  48.